<template>
	<div>
		<div>
			<div>
				<div style="margin-bottom: 10px;display: inline-block;width: 100%;">
					<div style="position: relative;display: inline-block;">
						<span>师傅昵称：</span>
						<el-input style="width: 200px;" @keydown.enter.native="phoneSelect" placeholder="请输入师傅昵称"
							v-model="nickNameT">
						</el-input>&nbsp;&nbsp;
					</div>
					<span style="display: inline-block;text-align: right;">城市：</span>
					<el-cascader style="width:30%" size="large" :options="options" ref="cascaderAddr"
						v-model="storeAddress" :placeholder="storeAddre" @change="handleChange55" :value="storeAddre">
					</el-cascader>&nbsp;&nbsp;&nbsp;&nbsp;
					<el-button style="margin-left:15px;" size="mini" type="primary" icon="document"
						@click="phoneSelect">刷新</el-button>
					<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleans">重置
					</el-button>
				</div>

			</div>
		</div>
		<div>
			<div id="container" style="width:95%;height:80vh;margin-left: 2.5%;position: relative;"
				v-loading="tableDataLoadingDt"></div>
		</div>
		<div>
			<!-- 待服务订单 -->
			<el-dialog title="师傅列表" :visible.sync="dialogFormVisible2" center width="70%" style="z-index: 1000;">
				<div style="margin:2% 0;display: inline-block;">
					<span>手机号:</span>
					<el-input style="width: 150px;" @keydown.enter.native="selectU" clearable placeholder="请输入手机号"
						v-model="phoneU"></el-input>
				</div>
				<div style="margin:2% 0;display: inline-block;">
					<span>昵称:</span>
					<el-input style="width: 150px;" @keydown.enter.native="selectU" clearable placeholder="请输入昵称"
						v-model="campus"></el-input>
				</div>
				<div style="margin:2% 0;display: inline-block;">
					<span>司机名称:</span>
					<el-input style="width: 150px;" @keydown.enter.native="selectU" clearable placeholder="请输入司机名称"
						v-model="driverNameT"></el-input>
				</div>
				
				<div style="display: inline-block;">
					<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="selectU">查询
					</el-button>
					<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleansU">重置
					</el-button>
				</div>
				<el-table v-loading="tableDataLoadingU" :data="userData.list">
					<el-table-column prop="userId" label="编号" width="80">
					</el-table-column>
					<el-table-column prop="driverName" label="用户昵称" width="120">
						<template slot-scope="scope">
							　<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row.userId)"
								v-text="scope.row.userName"></span>
						</template>
					</el-table-column>
					<el-table-column prop="driverName" label="司机名称" width="120">
						<template slot-scope="scope">
							　<span
								v-text="scope.row.driverName"></span>
						</template>
					</el-table-column>
					<el-table-column prop="phone" label="手机号"width="160">
					</el-table-column>
					<el-table-column prop="deilveryAddressDetail" label="出发地址" width="200">
						<template slot-scope="scope">
							<div>
								{{scope.row.shipProvince}}{{scope.row.shipCity}}{{scope.row.shipDistrict}}{{scope.row.shipAddress}}
							</div>
							<div>目的经纬度：{{scope.row.shipAddressLatitude}} {{scope.row.shipAddressLongitude}}</div>
						</template>
					</el-table-column>
					<el-table-column prop="deilveryAddressDetail" label="目的地址" width="200">
						<template slot-scope="scope">
							<div>
								{{scope.row.deliveryProvince}}{{scope.row.deliveryCity}}{{scope.row.deliveryDistrict}}{{scope.row.deliveryAddress}}
							</div>
							<div>目的经纬度：{{scope.row.deliveryAddressLatitude}} {{scope.row.deliveryAddressLongitude}}</div>
						</template>
					</el-table-column>
					<el-table-column prop="messageCount" label="是否邀请过车主">
						<template slot-scope="scope">
							<div v-if="scope.row.messageCount==1">是</div>
							<div v-else>否</div>
						</template>
					</el-table-column>
					<el-table-column prop="ordersCount" label="接单数量" width="160">
					</el-table-column>
					<el-table-column prop="driverPlate" label="车辆品牌" width="160">
					</el-table-column>
					<el-table-column prop="similarity" label="顺路百分比" width="160">
					</el-table-column>
					<el-table-column label="操作" prop="id" width="100" fixed='right' align="center">
						<template slot-scope="scope">
							<el-button size="mini" type="primary" @click="userBtns(scope.row)">确认
							</el-button>
						</template>
					</el-table-column>
				</el-table>
				<div style="text-align: center;margin-top: 10px;">
					<el-pagination @size-change="handleSizeChangeU" @current-change="handleCurrentChangeU"
						:page-sizes="[10, 20, 30, 40]" :page-size="limit1" :current-page="page1"
						layout="total,sizes, prev, pager, next,jumper" :total="userData.totalCount">
					</el-pagination>
				</div>
			</el-dialog>
			<!-- 订单列表 -->
			<el-dialog title="订单列表" :visible.sync="dialogFormVisible" center width="80%">
				<div>
					<div style="position: relative;display: inline-block;margin:5px;">
						<span>状态：</span>
						<el-select v-model="indentState" style="width:150px;margin-left: 10px;" @change="selectO()">
							<el-option v-for="item in statesnum1" :key="item.value" :label="item.label" :value="item.value">
							</el-option>
						</el-select>&nbsp;&nbsp;
					</div>
					<div style="position: relative;display: inline-block;margin:5px;">
						<span>订单号:</span>
						<el-input style="width: 200px;" @keydown.enter.native="selectO" placeholder="请输入订单号"
							v-model="indentNumber">
						</el-input>&nbsp;&nbsp;
					</div>
					<div style="position: relative;display: inline-block;">
						<span>预约人数:</span>
						<el-input style="width: 200px;" @keydown.enter.native="selectO" placeholder="请输入预约人数" v-model="phoneT">
						</el-input>&nbsp;&nbsp;
					</div>
					
					<div style="position: relative;display: inline-block;margin:5px;">
						<span>下单手机号:</span>
						<el-input style="width: 200px;" @keydown.enter.native="selectO" placeholder="请输入下单手机号"
							v-model="shipUserPhone">
						</el-input>&nbsp;&nbsp;
					</div>
					<div style="position: relative;display: inline-block;margin:5px;">
						<span>下单人昵称:</span>
						<el-input style="width: 200px;" @keydown.enter.native="selectO" placeholder="请输入下单人昵称"
							v-model="riderNickName">
						</el-input>&nbsp;&nbsp;
					</div>
					<div style="position: relative;display: inline-block;margin:5px;">
						<span>出发地址:</span>
						<el-input style="width: 200px;" @keydown.enter.native="selectO" placeholder="请输入出发地址"
							v-model="riderPhone">
						</el-input>&nbsp;&nbsp;
					</div>
					<div style="position: relative;display: inline-block;">
						<span>目的地地址:</span>
						<el-input style="width: 200px;" @keydown.enter.native="selectO" placeholder="请输入目的地地址"
							v-model="customPhone">
						</el-input>&nbsp;&nbsp;
					</div>
					<el-button style="margin:10px;" size="mini" type="primary" icon="document" @click="selectO">查询
					</el-button>
					<el-button style="margin:10px;" size="mini" type="primary" icon="document" @click="cleansO">重置
					</el-button>&nbsp;&nbsp;
				</div>
				<el-table v-loading="tableDataLoadingU" :data="userData.list">
					<el-table-column fixed prop="ordersId" label="编号" width="80">
					</el-table-column>
					<el-table-column prop="indentId" label="下单人昵称" width="120">
						<template slot-scope="scope">
							<div style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row.userId)">
								{{scope.row.shipUserName}}
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="shipUserPhone" label="下单手机号"></el-table-column>
					<el-table-column prop="appointmentType" label="预约类型">
						<template slot-scope="scope">
							<div v-if="scope.row.appointmentType==1">独享</div>
							<div v-if="scope.row.appointmentType==2">拼单</div>
						</template>
					</el-table-column>
					<el-table-column prop="ordersNo" label="订单号"></el-table-column>
					<el-table-column prop="shipProvince" label="出发地址" width="200">
						<template slot-scope="scope">
							<div>{{scope.row.shipProvince}}{{scope.row.shipCity}}{{scope.row.shipDistrict}}{{scope.row.shipAddress}}</div>
							<div>目的经纬度：{{scope.row.shipAddressLatitude}} {{scope.row.shipAddressLongitude}}</div>
						</template>
					</el-table-column>
					<el-table-column prop="deilveryAddressDetail" label="目的地址" width="200">
						<template slot-scope="scope">
							<div>{{scope.row.deliveryProvince}}{{scope.row.deliveryCity}}{{scope.row.deliveryDistrict}}{{scope.row.deliveryAddress}}</div>
							<div>目的经纬度：{{scope.row.deliveryAddressLatitude}} {{scope.row.deliveryAddressLongitude}}</div>
						</template>
					</el-table-column>
					<el-table-column prop="appointmentStartTime" label="预约开始时间" width="140">
					</el-table-column>
					<el-table-column prop="appointmentEndTime" label="预约结束时间" width="140">
					</el-table-column>
					<el-table-column prop="appointmentNum" label="预约人数"></el-table-column>
					<el-table-column prop="oneUserMoney" label="一级用户收益">
						<template slot-scope="scope">
							<div style="color: #f56c6c;cursor: pointer;" @click="updatesvideo(scope.row.oneUserId)">
								{{scope.row.oneUserMoney?scope.row.oneUserMoney:'0'}}
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="twoUserMoney" label="二级用户收益">
						<template slot-scope="scope">
							<div style="color: #f56c6c;cursor: pointer;" @click="updatesvideo(scope.row.twoUserId)">
								{{scope.row.twoUserMoney?scope.row.twoUserMoney:'0'}}
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="oneDriverUserMoney" label="一级师傅收益">
						<template slot-scope="scope">
							<div style="color: #f56c6c;cursor: pointer;" @click="updatesvideo(scope.row.oneDriverUserId)">
								{{scope.row.oneDriverUserMoney?scope.row.oneDriverUserMoney:'0'}}
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="twoDriverUserMoney" label="二级师傅收益">
						<template slot-scope="scope">
							<div style="color: #f56c6c;cursor: pointer;" @click="updatesvideo(scope.row.twoDriverUserId)">
								{{scope.row.twoDriverUserMoney?scope.row.twoDriverUserMoney:'0'}}
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="pingMoney" label="平台收入">
					</el-table-column>
					<el-table-column prop="driveMoney" label="师傅收入">
					</el-table-column>
					<el-table-column prop="sumMoney" label="订单总金额">
					</el-table-column>
					<el-table-column prop="couponMoney" label="优惠券抵扣金额">
					</el-table-column>
					<el-table-column prop="payMoney" label="支付金额">
						<template slot-scope="scope">
							<div style="color: #f56c6c;">
								{{scope.row.payMoney?scope.row.payMoney:'0'}}
							</div>
						</template>
					</el-table-column>
					<el-table-column prop="kmDistance" label="总公里数(公里)" width="160">
					</el-table-column>
					<el-table-column prop="distance" label="总米数(米)" width="160">
					</el-table-column>
					<el-table-column prop="remark" label="备注" width="200">
						<template slot-scope="scope">
							<span>{{scope.row.remark}}</span>
						</template>
					</el-table-column>
					<el-table-column prop="payWay" label="支付方式">
						<template slot-scope="scope">
							<div v-if="scope.row.payWay==1">微信小程序</div>
							<div v-else-if="scope.row.payWay==2">微信公众号</div>
							<div v-else-if="scope.row.payWay==3">微信APP</div>
							<div v-else-if="scope.row.payWay==4">支付宝</div>
							<div v-else-if="scope.row.payWay==5">零钱</div>
							<div v-else>-</div>
						</template>
					</el-table-column>
					<el-table-column prop="takingTime" label="接单时间" width="160">
					</el-table-column>
					<el-table-column prop="payTime" label="支付时间" width="160">
					</el-table-column>
					<el-table-column prop="startTime" label="开始等待时间" width="160">
					</el-table-column>
					<el-table-column prop="endTime" label="完成时间" width="160">
					</el-table-column>
					<el-table-column prop="createTime" label="创建时间" width="160">
					</el-table-column>
					
					<el-table-column prop="isRefund" label="是否退款" fixed="right">
						<template slot-scope="scope">
							<div style="color: #ff4949;" v-if="scope.row.isRefund==1">是</div>
							<div v-else>否</div>
						</template>
					</el-table-column>
					<el-table-column prop="status" label="状态" fixed="right">
						<template slot-scope="scope">
							<div v-if="scope.row.status==6">已取消</div>
							<div v-if="scope.row.status==1">待支付</div>
							<div v-if="scope.row.status==2">待接单</div>
							<div v-if="scope.row.status==3">已接单</div>
							<div v-if="scope.row.status==4">进行中</div>
							<div v-if="scope.row.status==5">已抵达</div>
						</template>
					</el-table-column>
				</el-table>
			</el-dialog>

		</div>
		<!-- <img src="../../assets/img/qishou.png" /> -->


	</div>
</template>

<script>
	import {
		jsonp
	} from 'vue-jsonp'
	import {
		provinceAndCityData,
		regionData,
		provinceAndCityDataPlus,
		regionDataPlus,
		CodeToText,
		TextToCode
	} from 'element-china-area-data'
	var geocoder, map, markersArray, infoWindow = [];
	export default {
		data() {
			return {
				limit: 10,
				page: 1,
				shopName1: '',
				shopId: '',
				shopName: '',
				openTime: '',
				closeTime: '',
				detailedAddress: '',
				shopLng: '',
				shopLat: '',
				percentage1: 0, //进度条
				img: [], //任务轮播图
				// img: '',
				classn: '',
				value: [],
				parentId: 0,
				parentIdnum: '',

				tableDataLoading: false,
				dialogFormVisible1: false,
				dialogFormVisible2: false,
				dialogFormVisible3: false,
				dialogFormVisible: false,
				typeDatas: {},
				typeDatas1: {},
				titles: '添加',
				// 地图相关
				longitude: '', //经度
				latitude: '', //维度
				loadingMap: true,
				BMap: '',
				map: '',
				geoc: '',
				keyword: '',
				showMap: false,
				pointLngLat: '',
				center: {
					lng: 108.948024,
					lat: 34.263161
				},
				lng: 108.948024,
				lat: 34.263161,
				storeAddress: [],
				storeAddre: '请选择城市',
				form: {
					province: '',
					city: '', //市
					district: '', //区
				},
				dialogImageUrl: [],
				dialogVisible: false,
				erweimaImg: '',
				activeName: 'first',
				shopTypeName: '',
				shopTypId: '',
				titles1: '',
				labels: [], //标签集合
				bq: '', //输入的标签名
				province: '',
				city: '', //市
				district: '', //区
				options: regionData,
				shopCover: '',
				shopTypenum: [],
				typeDatas2: [],
				shopType: '',
				geometries: [],
				center: '',
				map: '',
				lists: [],
				index1: 0,
				tableData: {},
				hospitalId: '',
				ordersNo: '',
				userName: '',
				type: '',
				marker: '',
				infoWindowList: [],
				typeNum: [{
						value: '',
						label: '全部'
					},
					{
						value: 1,
						label: '陪诊订单'
					},
					{
						value: 2,
						label: '陪护订单'
					},
				],
				userData: [],
				tableDataLoadingU: false,
				dialogFormVisible: false,
				limit1: 10,
				page1: 1,
				phone: '',
				driverNameT: '',
				ordersId: '',
				pd: '',
				titles: '信息详情',
				dialogFormVisibleDel: false,
				detaDatle: {},
				datleIndex: 1,
				// 指派
				userData: {},
				phoneU: '',
				campus: '',
				ordersId: '',
				limit1: 10,
				page1: 1,
				dialogFormVisible: false,
				tableDataLoadingU: false,
				tableDataZd: [],
				laundryId: '',
				laundryIdU: '',
				nickNameT: '',
				tableDataLoadingDt: false,
				driverId:'',
				
				statesnum1: [ {
						value: 3,
						label: '已接单'
					}, {
						value: 4,
						label: '进行中'
					}
				],
				indentState:3,
				indentNumber:'',
				phoneT:'',
				riderPhone:'',
				customPhone:'',
				shipUserPhone:'',
				
				
				
			}
		},
		methods: {
			handleSizeChange(val) {
				this.limit = val
				this.dataSelectoder()
			},
			handleCurrentChange(val) {
				this.page = val
				this.dataSelectoder()
			},
			handleSizeChangeU(val) {
				this.limit1 = val;
				this.dataSelectUser()()
			},
			handleCurrentChangeU(val) {
				this.page1 = val;
				this.dataSelectUser()
			},
			//定位获得当前位置信息
			getMyLocation() {
				var geolocation = new qq.maps.Geolocation("ZBABZ-ZWECU-UQTVV-4LYDR-COK3F-5SF75", "来点小收入");
				geolocation.getIpLocation(this.showPosition, this.showErr);
			},
			showPosition(position) {
				this.setMap();
			},
			showErr(e) {
				this.getMyLocation(); //定位失败再请求定位，测试使用
			},
			//位置信息在地图上展示
			setMap() {
				console.log('地图定位：', this.longitude, this.latitude, )
				var center = new TMap.LatLng(this.latitude, this.longitude);
				if (map) {
					map.destroy();
				}
				map = []
				infoWindow = []
				// 初始化地图
				map = new TMap.Map('container', {
					zoom: 13, // 设置地图缩放级别
					pitch: 30,
					center: center, // 设置地图中心点坐标
					// mapStyleId: "style1", //个性化样式
					baseMap: {
						type: 'vector',
						// features: ['base', 'building3d'], // 隐藏矢量文字
					},
				});


				// var center = new TMap.LatLng(this.latitude, this.longitude);
				// if (map) {
				// 	map.destroy();
				// }
				// map = []
				// infoWindow = []
				// // 初始化地图
				// map = new TMap.Map('container', {
				// 	zoom: 13, // 设置地图缩放级别
				// 	pitch: 30,
				// 	center: center, // 设置地图中心点坐标
				// 	// mapStyleId: "style1", //个性化样式
				// 	baseMap: {
				// 		type: 'vector',
				// 		features: ['base', 'building3d'], // 隐藏矢量文字
				// 	},
				// });
				// 师傅标记
				var imgUrl=""
				this.marker = new TMap.MultiMarker({
					map: map,
					styles: {
						default: new TMap.MarkerStyle({
							width: 66, // 宽度
							height: 66, // 高度
							anchor: {
								x: 46,
								y: 46
							}, // 锚点位置
							src: imgUrl, // 标注点图片url或base64地址
							color: '#333',
							size: 16,
							direction: 'bottom',
							strokeColor: '#fff',
							offset: { x: 0, y: 5 },
							strokeWidth: 2,
							'angle': 0,
						}),
					},
					geometries: this.geometries
				});
				/* if(this.infoWindowList && this.infoWindowList.length>0){
					for(var i in this.infoWindowList){
						var infoWindow=this.infoWindowList[i];
						infoWindow.close()
					}
				} */


				//初始化infoWindow
				console.log('this.geometries', this.geometries)
				// infoWindow.clear();
				for (var i in this.geometries) {
					infoWindow = new TMap.InfoWindow({
						map: map,
						position: new TMap.LatLng(this.geometries[i].datas.lat, this.geometries[i].datas.lng),
						offset: {
							x: 0,
							y: -32
						} //设置信息窗相对position偏移像素
					});
					// infoWindow.clears();//关闭信息窗
					// infoWindow.setContent('待服务数量：1'); //设置信息窗内容
					infoWindow.setContent('未完成订单：' + this.geometries[i].datas.indentCount); //设置信息窗内容
					infoWindow.open(); //初始信息窗开启
					//this.infoWindowList.push(infoWindow);
					// infoWindow.close(); //关闭信息窗
				}
				let that = this
				this.marker.on("click", function(evt) {
					console.log(evt.geometry)
					// that.hospitalId = evt.geometry.datas.artificerId
					that.zhuandan(evt.geometry.datas,1)
					that.dialogFormVisible = true
				})
				// 订单标记
				
				this.marker = new TMap.MultiMarker({
					map: map,
					styles: {
						default: new TMap.MarkerStyle({
							width: 25, // 宽度
							height: 35, // 高度
							anchor: {
								x: 16,
								y: 32
							}, // 锚点位置
							src: 'https://mapapi.qq.com/web/lbs/javascriptGL/demo/img/markerDefault.png', // 标注点图片url或base64地址
							color: '#ff4949', // 标注点文本颜色
							size: 14, // 标注点文本文字大小
							offset: {
								x: 0,
								y: 16
							}, // 标注点文本文字基于direction方位的偏移属性
						}),
					},
					geometries: this.lists
				});
				for (var i in this.lists) {
					infoWindow = new TMap.InfoWindow({
						map: map,
						position: new TMap.LatLng(this.lists[i].datas.shipAddressLatitude, this.lists[i].datas
							.shipAddressLongitude),
						offset: {
							x: 0,
							y: -32
						} //设置信息窗相对position偏移像素
					});
					// infoWindow.clears();//关闭信息窗
					// infoWindow.setContent('待服务数量：1'); //设置信息窗内容
					infoWindow.setContent('下单用户：' + this.lists[i].datas.shipUserName); //设置信息窗内容
					infoWindow.open(); //初始信息窗开启
					//this.infoWindowList.push(infoWindow);
					// infoWindow.close(); //关闭信息窗
				}

				// let that = this
				this.marker.on("click", function(evt) {
					console.log(evt.geometry)
					// that.hospitalId = evt.geometry.datas.artificerId
					that.zhuandan(evt.geometry.datas,2)
					that.dialogFormVisible2 = true
				})

			},
			// 地图定位
			select() {
				console.log(this.detailedAddress)
				// this.address = this.province+ this.city+this.district+this.address
				var addr = this.province + this.city + this.district + this.address
				let that = this
				jsonp('https://apis.map.qq.com/ws/geocoder/v1/?address==' + addr +
					'&key=ZBABZ-ZWECU-UQTVV-4LYDR-COK3F-5SF75&get_poi=1&output=jsonp', {
						myCustomUrlParam: 'veryNice'
					}).then(response => {
					// handle success
					console.log('response', response)
					that.longitude = response.result.location.lng; // 经度
					that.latitude = response.result.location.lat; // 纬度
					// that.address = response.result.title
					that.setMap()
				}).catch(error => {
					// handle error
				}).then(() => {
					// always executed
				});
			},
			// 医院点击事件
			bindClick() {
				this.dialogFormVisible2 = true
				this.dataSelectoder()
			},
			onprogress1(event, file, fileList) {
				console.log('详情图上传进度', parseInt(event.percent))
				this.percentage1 = parseInt(event.percent)
			},
			phoneSelect() {
				this.dataSelect()
			},
			// 获取省市区
			handleChange55(value) {
				value = this.$refs['cascaderAddr'].currentLabels
				this.province = value[0]
				this.city = value[1]
				this.district = value[2]
				// this.form.city = value[1]
				if (this.city == '市辖区') {
					this.city = this.province
				}
				this.dataSelect()
			},
			handleChange() {
				this.$router.push({
					path: '/riderScheduling',
				})
			},
			dataSelect() {
				this.tableDataLoadingDt = true
				this.$http({
					url: this.$http.adornUrl('timedtask/selectAllRiderLocation'),
					method: 'get',
					params: this.$http.adornParams({
						'province': this.province,
						'city': this.city,
						'district': this.district,
						'nickName': this.nickNameT
					})
				}).then(({
					data
				}) => {
					console.log(data)
					var arr = []
					var arr1 = []
					if (data.data.riderList.length > 0) {

						for (var i in data.data.riderList) {
							if (data.data.riderList[i].userEntity) {
								if (data.data.riderList[i].lat && data.data.riderList[i].lng) {
									var obj = {}
									obj.position = new TMap.LatLng(data.data.riderList[i].lat, data.data.riderList[
										i].lng)
									obj.datas = data.data.riderList[i]
									obj.img = data.data.riderList[i].artificerImg
									obj.content = data.data.riderList[i].userEntity.nickName
									arr.push(obj)
									this.longitude = data.data.riderList[0].lng
									this.latitude = data.data.riderList[0].lat
								}
							}


						}

						this.geometries = arr
						this.tableDataLoadingDt = false
						this.setMap();

					}
					if (data.data.ordersList.length > 0) {

						for (var i in data.data.ordersList) {
							// if (data.data.indentList[i].userEntity) {
							if (data.data.ordersList[i].shipAddressLatitude && data.data.ordersList[i]
								.shipAddressLongitude) {
								var obj = {}
								obj.position = new TMap.LatLng(data.data.ordersList[i].shipAddressLatitude, data
									.data.ordersList[
										i].shipAddressLongitude)
								obj.datas = data.data.ordersList[i]
								obj.img = data.data.ordersList[i].artificerImg
								obj.content = data.data.ordersList[i].shipUserName
								arr1.push(obj)
								this.longitude = data.data.ordersList[0].shipAddressLongitude
								this.latitude = data.data.ordersList[0].shipAddressLatitude
							}
							// }


						}

						// this.geometries = arr
						this.lists = arr1
						this.tableDataLoadingDt = false
						this.setMap();


					} else {
						this.lists = []
					}

					if (data.data.indentList.length == 0 && data.data.riderList.length == 0) {
						this.$message({
							message: '暂无数据',
							type: 'warning',
							duration: 1500,
							onClose: () => {}
						})
						this.tableDataLoadingDt = false
						this.setMap();
					}

				})
			},
			// 重置
			cleans() {
				this.nickNameT = ''
				this.province = ''
				this.city = ''
				this.district = ''
				this.storeAddress = []
				this.storeAddre = '请选择城市'
				this.dataSelect()
			},
			// 详情跳转
			updates(userId) {
				if (userId) {
					if (userId) {
						this.$router.push({
							path: '/userDetail',
							query: {
								userId: userId
							}
						})
					}
				}

			},
			// select选择事件
			animeDat(state) {
				this.page = 1
				this.dataSelectoder()
			},
			cleansDet() {
				this.page = 1
				this.type = ''
				this.userName = ''
				this.ordersNo = ''
				this.dataSelectoder()
			},

			// 获取医院订单
			dataSelectoder() {
				this.tableDataLoading = true
				this.$http({
					url: this.$http.adornUrl('artificer/selectOrdersList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page,
						'limit': this.limit,
						'status': 2,
						'artificerId': this.hospitalId
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					let returnData = data.data;
					this.tableData = returnData

				})
			},

			// // 获取师傅订单数据
			dataSelectOrder(userId) {
				this.$http({
					url: this.$http.adornUrl('driver/selectDriverByUserId'),
					method: 'get',
					params: this.$http.adornParams({
						'driverId': userId
						
					})
					
				}).then(({
					data
				}) => {
					this.driverId = data.data.driverId
					this.dataSelectDd()
				})
				
				
				
			},
			dataSelectDd(){
				this.tableDataLoadingU = true
				this.$http({
					url: this.$http.adornUrl('orders/selectOrdersList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page1,
						'limit': this.limit1,
						'appointmentType': this.indentType,
						'appointmentNum': this.phoneT,
						'status': this.indentState,
						'shipProvince': '',
						'shipCity': '',
						'shipDistrict': '',
						'shipAddress':this.riderPhone,
						'ordersNo': this.indentNumber,
						'deliveryProvince':'',
						'deliveryCity': '',
						'deliveryDistrict': '',
						'deliveryAddress':this.customPhone,
						'userName': '',
						'phone': '',
						'shipUserName':'',
						'shipUserPhone': this.shipUserPhone,
						'driverName':'',
						'driverPhone':'',
						'driverId': this.driverId,
						
						
					})
				}).then(({
					data
				}) => {
					this.tableDataLoadingU = false
					let returnData = data.data
					this.userData = returnData
				})
			},
			selectO(){
				this.page1 = 1
				this.dataSelectDd()
			},
			cleansO(){
				this.page1 = 1
				this.indentState = 3,
				this.indentNumber = ''
				this.phoneT = ''
				this.riderPhone = ''
				this.customPhone = ''
				this.shipUserPhone = ''
				this.dataSelectDd()
			},
			// 转单弹框
			zhuandan(row,index) {
				if (index==2) {
					this.page1 = 1
					this.ordersId = row.indentId
					this.dataSelectUser()
					this.dialogFormVisible2 = true
				} else {
					this.page1 = 1
					this.driverId = row.driverId
					this.indentState = 3,
					this.indentNumber = ''
					this.phoneT = ''
					this.riderPhone = ''
					this.customPhone = ''
					this.shipUserPhone = ''
					this.dataSelectDd()
					this.dialogFormVisible = true
				}

			},
			// 确认选择
			userBtns(row) {
				this.$http({
					url: this.$http.adornUrl('orders/takingOrders'),
					method: 'post',
					params: this.$http.adornParams({
						'userId': row.userId,
						'indentId': this.ordersId,
						'driverRouteId':row.driverRouteId,
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
								this.dialogFormVisible2 = false
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {}
						})
					}


				})
			},
			// 获取数据列表
			dataSelectUser() {
				this.tableDataLoadingU = true
				this.$http({
					url: this.$http.adornUrl('driverRoute/selectDriverRouteList'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page1,
						'limit': this.limit1,
						'userName': this.campus,
						'phone': this.phoneU,
						'shipProvince': '',
						'shipCity': '',
						'shipDistrict': '',
						'shipAddress': '',
						'deliveryProvince': '',
						'deliveryCity': '',
						'deliveryDistrict': '',
						'deliveryAddress': '',
						'driverName':this.driverNameT,
					
					
					})
					
				}).then(({
					data
				}) => {
					this.tableDataLoadingU = false
					let returnData = data.data
					this.userData = returnData
				})
			},
			
			// 查询
			selectU() {
				this.page = 1
				this.dataSelectUser()
			},
			// 重置
			cleansU() {
				this.page1 = 1
				this.campus = ''
				this.phoneU = ''
				this.driverNameT = ''
				this.laundryIdU = ''
				this.dataSelectUser()
			},
		},
		created() {

		},
		mounted() {
			let data = {
				key: "ZBABZ-ZWECU-UQTVV-4LYDR-COK3F-5SF75", //申请的密钥
				output: "jsonp",
			};
			let url = "https://apis.map.qq.com/ws/location/v1/ip"
			this.$jsonp(url, data).then(res => {
				console.log('获取Ip定位成功----')
				this.longitude = res.result.location.lng
				this.latitude = res.result.location.lat
				this.setMap();
			}).catch(err => {
				this.$toast('获取Ip定位失败--', err.message)
			})
			// 
			// this.getMyLocation()
			this.dataSelect()

		}
	}
</script>

<style>
	.imgs {
		position: relative;
		border-radius: 6px;
		width: 148px;
		height: 148px;
		margin-right: 10px;
		display: inline-block;
	}

	.dels {
		position: absolute;
		top: 0;
		left: 0;
		display: none;
	}

	.dels .el-icon-delete {
		line-height: 148px;
		padding-left: 58px;
		font-size: 25px;
		color: #fff;
	}

	.imgs:hover .dels {
		width: 100%;
		height: 100%;
		background: #000;
		display: block;
		opacity: 0.5;
	}

	.bqList {
		padding: 4px 14px;
		margin: 4px;
		border: 1px solid #efefef;
		font-size: 12px;
		color: #999;
		border-radius: 4px;
		margin-right: 15px;
	}

	.delss {
		display: none;
		position: relative;
	}

	.delss .el-icon-delete {
		position: absolute;
		top: 0;
	}

	.bqList:hover .delss {
		display: initial;
		opacity: 0.5;

	}

	.tj {
		padding: 6px !important;
		margin: 4px;
		font-size: 12px;
		border: 1px solid #ccc;
		border-radius: 4px;
	}

	.csssprite {
		width: 100% !important;
		height: 100% !important;
		border-radius: 50% !important;
		min-width: 100% !important;
		max-width: 100% !important;
		min-height: 100% !important;
		max-height: 100% !important;
		border: 3px solid red !important;
	}
</style>